<template>
  <!-- 名称配置 -->
  <!-- <el-dialog
      title="名称配置"
      :visible.sync="moduleNameDialogVisible"
      width="40%"
      :close-on-click-modal="false"
  :show-close="false">-->
  <div>
    <div style="text-align: left;">
      <el-form inline size="medium" v-if="datas">
      <el-form-item label="名称配置:">
        <el-input v-model="dataForm.title" ></el-input>
      </el-form-item>
      <el-form-item label="跳转地址">
        <el-input v-model="dataForm.jumpLink" ></el-input>
      </el-form-item>
    </el-form>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close" size="mini">取消</el-button>
      <el-button type="primary" @click="saveModuleNameConf" size="mini">确定</el-button>
    </div>
  </div>

  <!-- </el-dialog> -->
</template>

<script>
export default {
  name: "moduleName",
  props: {
    moduleId: {
      type: String
    },
    moduleNameDialogVisible: {
      type: Boolean
    },
    datas: {
      type: Object,
      default: () => {
        return {};
      }
    }
  },
  data() {
    return {
      formLabelWidth: "60",
      dataForm: {jumpLink: "", title: ""}
    };
  },
  mounted() {
    console.log(this.datas);
  },
  methods: {
    close() {
      // this.MoreMapDialogVisible=false
      this.$router.push("/Pages/Configuration/Cms/CmsPages");
    },
    /**
     * 名称配置保存
     */
    saveModuleNameConf() {
      // this.$set(this.dataForm,"jumpLink","http://"+this.dataForm.jumpLink);
      let variablesObject = {};
      variablesObject.title = this.dataForm.title;
      variablesObject.jumpLink = this.dataForm.jumpLink;
      this.utils.request.cmsPageModuleAddModuleData(
        {
          templateDataType: 0,
          moduleId: this.moduleId,
          variablesObject: variablesObject
        },
        res => {
          if (res.code == "0000") {
            this.$emit("TitleMapDialogVisibleFun");
            this.$emit("getIndex");
            this.$message({ message: "保存成功", type: "success" });
          } else {
            this.$message({ message: res.msg, type: "error" });
          }
        }
      );
    },
    /**
     * dataForm赋值
     */
    moduleNameDataFormToJSON(moduleNameDataForm) {

    }
  },
  mounted(){
    this.dataForm = this.datas;
  }
};
</script>

<style>
</style>
